package com.lago.controller;

import com.lago.pojo.Article;
import com.lago.service.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;


@Controller
public class ArticleController {
    @Autowired
    private ArticleService articleService;


    @RequestMapping("/findAll")
    public String findAll(Model model, @RequestParam(value = "pageNum", defaultValue = "0") int pageNum,
                          @RequestParam(value = "pageSize", defaultValue = "2") int pageSize) {
        Page<Article> forPage = articleService.findForPage(pageNum, pageSize);
        model.addAttribute("article_list", forPage);
        return "client/index";
    }
}
